import Vue from "vue";
import Vuex from "vuex";
import * as getters from './getters'

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    type: localStorage.getItem("_type_"),
    info: JSON.parse(localStorage.getItem("_info_")),
    planType: JSON.parse(localStorage.getItem("_plan_type_")),
    tabType: localStorage.getItem("_tab_type_"),
  },
  mutations: {
    SET_TYPE: (state, type) => {
      state.type = type
      localStorage.setItem("_type_", type)
    },
    SET_TAB_TYPE: (state, type) => {
      state.tabType = type
      localStorage.setItem("_tab_type_", type)
    },
    SET_INFO: (state, info) => {
      state.info = info
      localStorage.setItem("_info_", JSON.stringify(info))
    },
    SET_PLAN_TYPE: (state, type) => {
      state.planType = type
      localStorage.setItem("_plan_type_", JSON.stringify(type))
    },
  },
  actions: {},
  modules: {},
  getters
});
